#include "point3D.h"


Point3D::Point3D(float x,float y, float z)
{
	this->x = x;
	this->y = y;
	this->z = z;
}

Point3D::Point3D(const Point3D& point)
{
	this->x = point.x;
	this->y = point.y;
	this->z = point.z;
}

bool Point3D::operator == (Point3D &p) const
{
	bool bret = false;

	if (x == p.x && y == p.y && z == p.z)
		bret = true;

	return bret;
}

Point3D Point3D::operator - (Point3D &p)const 
{
	Point3D point(0,0,0);
	
	point.x = x - p.x;
	point.y = y - p.y;
	point.z = z - p.z;

	return point;
}

Point3D Point3D::operator + (Point3D &p) const
{
	Point3D point(0,0,0);
	
	point.x = x + p.x;
	point.y = y + p.y;
	point.z = z + p.z;

	return point;
}

Point3D::~Point3D()
{
}

ListPoints3D::~ListPoints3D()
{
	DeleteAll();
}

void ListPoints3D::Delete(Point3D* point)
{
	for(unsigned int i = 0; i < size(); i++)
	{
		Point3D* currPoint = at(i);

		if (point == currPoint)
		{
			delete currPoint;
			erase(begin() - 1 + i);
			break;
		}
	}
}

void ListPoints3D::DeleteAll()
{
	for(int i = size() - 1; i >= 0; i--)
	{
		delete at(i);
		pop_back();
	}
}